#include <iostream>
using namespace std;
#include <cstring>

/* 
函数重载:
    1.  参数数量
    2.  参数类型
    3.  参数顺序 
*/
void func(int val)
{
    cout << "func(int val)" << endl;
}   

void func(int * pVal)
{
    cout << "func(int * pVal)" << endl;
}

int main()
{
    /*auto的使用*/
#if 0
    int a = 100;
    //从初始化中推断出变量的类型
    auto num = 222;//int 
    cout << "num:" << num <<endl;

    auto str = "hello world"; //const char *
    cout<< "str:"<< str <<endl;

    auto * pNum = &a;
    cout<<"*pNum"<<*pNum<<endl;
#endif

/*decltype可以获取的变量类型*/
#if 0
    /*decltype可以获取的变量类型*/
    int num = 666;
    decltype(num)value = 77;
    string str = "hello";
    decltype(str) ptr = "hello 2";
    cout<<"ptr:"<<ptr<<endl;

    /*结合auto*/
    auto val = "hello 3";
    decltype(val)buf = "hello 4";
    cout<<"buf:"<<buf<<endl;
#endif

#if 1
    int array1[5] = {11, 22, 33, 44, 55};
    cout<<sizeof(array1)/sizeof(array1[0])<<endl;

    int array2[] = {11, 22, 33, 44, 55};
    cout<<sizeof(array2)/sizeof(array2[0])<<endl;

    int array3[]{11, 22, 33, 44, 55};
    cout<<sizeof(array3)/sizeof(array3[0])<<endl;

    /*遍历*/
    for(int idx = 0; idx < sizeof(array2)/sizeof(array2[0]); idx++)
    {
        cout<<array2[idx]<<endl;
    }

    for(int item : array3)
    {
        cout<<item<<endl;
    }
#endif


    return 0;
}